﻿@inherits Project.Engine.Control.BasePageRazor
@{
    ViewBag.Title = "Chỉnh sửa nhà cung cấp";
    Layout = "~/Views/Backend/Home/_Master.cshtml";
    Project.Module.View.CMS.CMSEditSupplierView view = this.Model.DocumentObject as Project.Module.View.CMS.CMSEditSupplierView;
}
<h2>Chỉnh sửa nhà cung cấp</h2>
<table height="20px">
</table>
<form method="post">
<table border="0">
    <tr>
        <td>Tên nhà cung cấp</td>
        <td><input type="text" id="name" class="inp-form" value="@view.supplier.SupplierName" /></td>
    </tr>
    <tr height="10px">
    </tr>
    <tr>
        <td>Giới thiệu</td>
        <td><input type="text" id="description" class="inp-form" value="@view.supplier.description"/></td>
    </tr>
    <tr height="10px">
    </tr>
    <tr>
        <td>Địa chỉ</td>
        <td><input type="text" id="address" class="inp-form" value="@view.supplier.address"/></td>
    </tr>
    <tr height="10px">
    </tr>
    <tr>
        <td><input type="submit" id="btnAdd" class="add-form" /></td>&nbsp;&nbsp;
        <td><input type="submit" id="btnCancel" class="reset-form" /></td>
    </tr>
</table>
</form>
<table height="20px">
</table>
<script type="text/javascript">
    $('#btnAdd').click(function () {
        var link = '/admin/editSupplier';
        var supplierId = window.location.href;
        var name = document.getElementById('name').value;
        var address = document.getElementById('address').value;
        var description = document.getElementById('description').value;

        $.post(link, { 'id': supplierId, 'name': name, 'address': address, 'description': description }, function (data) {
            if (data.result == 1) {
                window.location = "/admin/quan-ly-nha-cung-cap";
            }
        });

        document.getElementById('name').value = '';
        document.getElementById('address').value = '';
        document.getElementById('description').value = '';

        // return
        return false;
    });

    $('#btnCancel').click(function () {
        document.getElementById('name').value = '';
        document.getElementById('address').value = '';
        document.getElementById('description').value = '';

        // return
        return false;
    });
</script>
